<?php get_header();?>

<div id="content">

<div id="content-main">

<?php if ($_SERVER['HTTP_USER_AGENT']) { ?>

<p style="padding:8px 0 8px;border-top:solid 1px #ccc;border-bottom:solid 1px #ccc" align="center">

<script type="text/javascript"><!--
google_ad_client = "<?php google_pub_id();?>";
google_ad_width = 250;
google_ad_height = 250;
google_ad_format = "250x250_as";
google_ad_type = "text_image";
google_color_border = "ffffff";
google_color_bg = "FFFFFF";
google_color_link = "458B74";
google_color_url = "000000";
google_color_text = "808080";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script type="text/javascript"><!--
google_ad_client = "<?php google_pub_id();?>";
google_ad_width = 250;
google_ad_height = 250;
google_ad_format = "250x250_as";
google_ad_type = "text_image";
google_color_border = "ffffff";
google_color_bg = "FFFFFF";
google_color_link = "458B74";
google_color_url = "000000";
google_color_text = "808080";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

</p>

<?php } ?>



<?php if (have_posts()) : ?>

		

		<?php while (have_posts()) : the_post(); ?>

				

			<div class="post">

				<div class="posttitle">

					<h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

					<p class="post-info"><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?> </p>

				</div>

				

				<div class="entry">

					<?php the_content('Continue Reading &raquo;'); ?>

				</div>

		

				<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> | <a rel="nofollow" href="<?php bloginfo('siteurl'); ?>/<?php print($post->ID); ?>/share/" title="<?php _e('E-mail this, post to del.icio.us, etc.'); ?>">Share</a></p>

				<?php comments_template(); ?>

			</div>

	

		<?php endwhile; ?>

<?php

$this_post = $post;

$category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;

$posts = get_posts('numberposts=6&offset=0&orderby=post_date&order=DESC&category='.$category);

$count = 0;

foreach ( $posts as $post ) {

if ( $post->ID == $this_post->ID || $count == 5) {

unset($posts[$count]);

}else{

$count ++;

}

}

?>

<?php if ( $posts ) : ?>

<div class="post">

<h3>Related articles</h3>

<ul>

<?php foreach ( $posts as $post ) : ?>

<li><a href="<?php the_permalink() ?>" title="<?php echo trim(str_replace("\n"," ",preg_replace('#<[^>]*?>#si','',get_the_excerpt()))) ?>"><?php if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; } ?></a> (<?php the_time('F jS, Y') ?>)</li>

<?php endforeach // $posts as $post ?>

</ul>

</div>

<?php endif // $posts ?>



		<p align="center"><?php posts_nav_link(' - ','&#171; Prev','Next &#187;') ?></p>

		

	<?php else : ?>



		<h2 class="center">Not Found</h2>

		<p class="center">Sorry, but you are looking for something that isn't here.</p>

	<?php endif; ?>

</div><!-- end id:content-main -->

<?php get_sidebar();?>

<?php get_footer();?>